Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added processing for client root spans #49

Merged

Conversation

dmitry-prokopchenkov
Copy link
Contributor

This is pull request for #35

@coveralls
Copy link

coveralls commented Jun 22, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 96ede73 on dmitry-prokopchenkov:dprokopchenkov-client-root-spans into 71ca501 on Yelp:master.

@coveralls
Copy link

coveralls commented Jun 22, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 143601d on dmitry-prokopchenkov:dprokopchenkov-client-root-spans into 71ca501 on Yelp:master.

Copy link
Contributor

@bplotnick bplotnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for submitting this! And sorry for taking so long to review it... Overall it looks really good. Just a few comments.

Additionally, could add a test case that checks that the decorator adds the correct root client span? So something like with zipkin_client_span(...): or with zipkin_span(...include=('client',)). I think this should fail currently due to the issue that I describe below

@@ -281,6 +281,7 @@ def start(self):
if not self.zipkin_attrs.is_sampled:
return self
endpoint = create_endpoint(self.port, self.service_name, self.host)
client_context = (self.include == {'client'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.include can be any iterable (i suppose we should assert this), so i don't think this will work unless you cast it to a set. So you should be able to do set(self.include) == {'client'}

Also you don't need the parentheses

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!


The trace can represent
1) server and contains root server span and child client spans (optionally)
2) client and contains root client span only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this new comment is not quite correct. The original comment was saying basically that the root span is a server span, but the local child spans can be client and/or server. In fact, our "local" spans use both cs/cr and ss/sr annotations.

You can still have this with a client root span. Imagine a application that will download some file, and also has some local method for validation that we instrumented. We might have

cs:          download_file
cs/sr/ss/sr: validate_parameters_locally
cs:          fetch_file_from_server
cr:          fetch_file_from_server
cr:          download_file

You could even imagine child server spans in there if somewhere in the middle we check some queue for new data.

All of this is pretty unfamiliar, so i'm open to any other opinions on this matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally agree with you, will change the comment

@@ -97,6 +101,7 @@ def log_spans(self):
)

# Collect, annotate, and log client spans from the logging handler
# In case of root client span client_spans list is empty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above, I don't think that this is quite correct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed my comment. May be it would be better to rename client_spans (self.log_handler.client_spans) to child_spans?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be totally cool with that if you'd like to tack that on to this PR. Otherwise, I can do that as a followup task.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second option, I can do that, but I would like to do it separately.

@bplotnick
Copy link
Contributor

looks good to me!

@kaisen can you take a quick look and see if anything pops out to you?

@dmitry-prokopchenkov
Copy link
Contributor Author

@bplotnick I am not good familiar with github pull request workflow. Should I close this pull request? Or at first wait for @kaisen's answer?

@bplotnick
Copy link
Contributor

@dmitry-prokopchenkov once @kaisen looks at it (i just poked him), assuming he has no objection, i will go ahead and merge your PR

@kaisen
Copy link
Member

kaisen commented Jun 29, 2017

nice! looks good

@kaisen kaisen self-requested a review June 29, 2017 18:31
@bplotnick bplotnick merged commit 50b6793 into Yelp:master Jun 29, 2017
@bplotnick
Copy link
Contributor

@dmitry-prokopchenkov this has been merged. Thanks so much for this!

@dmitry-prokopchenkov
Copy link
Contributor Author

thank you, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants